#!/bin/bash
set -e

function info() {
echo Usage: `basename $0` in.sam
exit 65
}

while getopts  ":s:p:" opts
do
        case  $opts  in
        s) sample_name=$OPTARG;;
		p) out_prefix=$OPTARG;;
		\?) echo info;;
        esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi


. /mnt/ilustre/app/medical/tools/.var

if
java -Xmx$java_memory -jar ${picard_path}SortSam.jar \
I=$1 \
O=$out_prefix.sort.bam \
SORT_ORDER=coordinate \
CREATE_INDEX=true
then
rm $1
fi

. $cmd_done
exit 0